﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using JohnnySins.DAL.Repositories;
using JohnnySins.Code;

namespace JohnnySins
{
    public class LogLoginHelper
    {
        public static void AddLogLogin(string loginName, string password, EpochAnswer epochAnswer)
        {
            try
            {
                var user = Membership.GetUser();

                string browser = HttpContext.Current.Request.Browser.Browser;
                string userHostAddress = HttpContext.Current.Request.UserHostAddress;

                using (var repo = RepositoryFactory.ResolveRepository<LogRepository>())
                {
                    repo.SaveLogLogin(loginName, password, epochAnswer.Answer, epochAnswer.Error, epochAnswer.IsActive, browser, userHostAddress);
                }
            }
            catch (Exception exNew)
            {
            }
        }
    }
}